<?php
/**
 * Author: Traveler
 * Time  : 2021/9/4 19:17
 */

namespace app\controller\crm\v1;


use app\service\DepartmentService;
use sunshine\basic\RestController;
use think\App;
use think\Response;

class Department extends RestController
{
    /**
     * Department constructor.
     *
     * @param App               $app
     * @param DepartmentService $service
     */
    public function __construct(App $app, DepartmentService $service)
    {
        parent::__construct($app);
        $this->service = $service;
    }

    /**
     * 创建(重写)
     *
     * @param string|null $validate 验证器名称
     * @return Response
     */
    public function create(?string $validate = null): Response
    {
        // 使用数据验证
        return parent::create('DepartmentValidate');
    }

    /**
     * 修改(重写)
     *
     * @param int         $id       ID
     * @param string|null $validate 验证器名称
     * @return Response
     */
    public function update(int $id, ?string $validate = null): Response
    {
        // 使用数据验证
        return parent::update($id, 'DepartmentValidate');
    }
}